home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_emacs.idb / usr / freeware / info / emacs-9.z / emacs-9
Encoding:
GNU Info File  |  1998-10-28  |  47.3 KB  |  1,168 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.63 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Change Window,  Prev: Force Same Window,  Up: Windows
  6.  
  7. Deleting and Rearranging Windows
  8. ================================
  9.  
  10. `C-x 0'
  11.      Delete the selected window (`delete-window').  That is a zero.
  12.  
  13. `C-x 1'
  14.      Delete all windows in the selected frame except the selected window
  15.      (`delete-other-windows').
  16.  
  17. `C-x ^'
  18.      Make selected window taller (`enlarge-window').
  19.  
  20. `C-x }'
  21.      Make selected window wider (`enlarge-window-horizontally').
  22.  
  23. `Drag-Mouse-1'
  24.      Dragging a window's mode line up or down with `Mouse-1' changes
  25.      window heights.
  26.  
  27. `Mouse-2'
  28.      `Mouse-2' in a window's mode line deletes all other windows in the
  29.      frame (`mouse-delete-other-windows').
  30.  
  31. `Mouse-3'
  32.      `Mouse-3' in a window's mode line deletes that window
  33.      (`mouse-delete-window').
  34.  
  35.    To delete a window, type `C-x 0' (`delete-window').  (That is a
  36. zero.)  The space occupied by the deleted window is given to an
  37. adjacent window (but not the minibuffer window, even if that is active
  38. at the time).  Once a window is deleted, its attributes are forgotten;
  39. only restoring a window configuration can bring it back.  Deleting the
  40. window has no effect on the buffer it used to display; the buffer
  41. continues to exist, and you can select it in any window with `C-x b'.
  42.  
  43.    `C-x 1' (`delete-other-windows') is more powerful than `C-x 0'; it
  44. deletes all the windows except the selected one (and the minibuffer);
  45. the selected window expands to use the whole frame except for the echo
  46. area.
  47.  
  48.    You can also delete a window by clicking on its mode line with
  49. `Mouse-2', and expand a window to fill its frame by clicking on its
  50. mode line with `Mouse-3'.
  51.  
  52.    The easiest way to adjust window heights is with a mouse.  If you
  53. press `Mouse-1' on a mode line, you can drag that mode line up or down,
  54. changing the heights of the windows above and below it.
  55.  
  56.    To readjust the division of space among vertically adjacent windows,
  57. use `C-x ^' (`enlarge-window').  It makes the currently selected window
  58. get one line bigger, or as many lines as is specified with a numeric
  59. argument.  With a negative argument, it makes the selected window
  60. smaller.  `C-x }' (`enlarge-window-horizontally') makes the selected
  61. window wider by the specified number of columns.  The extra screen
  62. space given to a window comes from one of its neighbors, if that is
  63. possible.  If this makes any window too small, it is deleted and its
  64. space is given to an adjacent window.  The minimum size is specified by
  65. the variables `window-min-height' and `window-min-width'.
  66.  
  67.    *Note Minibuffer Edit::, for information about the Resize-Minibuffer
  68. mode, which automatically changes the size of the minibuffer window to
  69. fit the text in the minibuffer.
  70.  
  71. 
  72. File: emacs,  Node: Frames,  Next: Major Modes,  Prev: Windows,  Up: Top
  73.  
  74. Frames and X Windows
  75. ********************
  76.  
  77.    When using the X Window System, you can create multiple windows at
  78. the X level in a single Emacs session.  Each X window that belongs to
  79. Emacs displays a "frame" which can contain one or several Emacs windows.
  80. A frame initially contains a single general-purpose Emacs window which
  81. you can subdivide vertically or horizontally into smaller windows.  A
  82. frame normally contains its own echo area and minibuffer, but you can
  83. make frames that don't have these--they use the echo area and
  84. minibuffer of another frame.
  85.  
  86.    Editing you do in one frame also affects the other frames.  For
  87. instance, if you put text in the kill ring in one frame, you can yank it
  88. in another frame.  If you exit Emacs through `C-x C-c' in one frame, it
  89. terminates all the frames.  To delete just one frame, use `C-x 5 0'.
  90.  
  91.    To avoid confusion, we reserve the word "window" for the
  92. subdivisions that Emacs implements, and never use it to refer to a
  93. frame.
  94.  
  95. * Menu:
  96.  
  97. * Mouse Commands::     Moving, cutting, and pasting, with the mouse.
  98. * Secondary Selection::Cutting without altering point and mark.
  99. * Mouse References::   Using the mouse to select an item from a list.
  100. * Menu Mouse Clicks::  Mouse clicks that bring up menus.
  101. * Mode Line Mouse::    Mouse clicks on the mode line.
  102. * Creating Frames::    Creating additional Emacs frames with various contents.
  103. * Multiple Displays::  How one Emacs job can talk to several displays.
  104. * Special Buffer Frames::  You can make certain buffers have their own frames.
  105. * Frame Parameters::   Changing the colors and other modes of frames.
  106. * Scroll Bars::           How to enable and disable scroll bars; how to use them.
  107. * Menu Bars::           Enabling and disabling the menu bar.
  108. * Faces::           How to change the display style using faces.
  109. * Modifying Faces::    How to change what a particular face looks like.
  110. * Font Lock::          Minor mode for syntactic highlighting using faces.
  111. * Support Modes::      Font Lock support modes make Font Lock faster.
  112. * Misc X::           Iconifying and deleting frames.    Region highlighting.
  113. * Non-Window Terminals::  Multiple frames on terminals that only show one.
  114.  
  115. 
  116. File: emacs,  Node: Mouse Commands,  Next: Secondary Selection,  Up: Frames
  117.  
  118. Mouse Commands for Editing
  119. ==========================
  120.  
  121.    The mouse commands for selecting and copying a region are mostly
  122. compatible with the `xterm' program.  You can use the same mouse
  123. commands for copying between Emacs and other X client programs.
  124.  
  125. `Mouse-1'
  126.      Move point to where you click (`mouse-set-point').  This is
  127.      normally the left button.
  128.  
  129. `Drag-Mouse-1'
  130.      Set the region to the text you select by dragging, and copy it to
  131.      the kill ring (`mouse-set-region').  You can specify both ends of
  132.      the region with this single command.
  133.  
  134.      If you move the mouse off the top or bottom of the window while
  135.      dragging, the window scrolls at a steady rate until you move the
  136.      mouse back into the window.  This way, you can select regions that
  137.      don't fit entirely on the screen.  The number of lines scrolled
  138.      per step depends on how far away from the window edge the mouse
  139.      has gone; the variable `mouse-scroll-min-lines' specifies a
  140.      minimum step size.
  141.  
  142. `Mouse-2'
  143.      Yank the last killed text, where you click (`mouse-yank-at-click').
  144.      This is normally the middle button.
  145.  
  146. `Mouse-3'
  147.      This command, `mouse-save-then-kill', has several functions
  148.      depending on where you click and the status of the region.
  149.  
  150.      The most basic case is when you click `Mouse-1' in one place and
  151.      then `Mouse-3' in another.  This selects the text between those two
  152.      positions as the region.  It also copies the new region to the kill
  153.      ring, so that you can copy it to someplace else.
  154.  
  155.      If you click `Mouse-1', scroll with the scroll bar, and then click
  156.      `Mouse-3', it remembers where point was before scrolling (where you
  157.      put it with `Mouse-1'), and uses that position as the other end of
  158.      the region.  This is so that you can select a region that doesn't
  159.      fit entirely on the screen.
  160.  
  161.      More generally, if you do not have a highlighted region, `Mouse-3'
  162.      selects the text between point and the click position as the
  163.      region.  It does this by setting the mark where point was, and
  164.      moving point to where you click.
  165.  
  166.      If you have a highlighted region, or if the region was set just
  167.      before by dragging button 1, `Mouse-3' adjusts the nearer end of
  168.      the region by moving it to where you click.  The adjusted region's
  169.      text also replaces the old region's text in the kill ring.
  170.  
  171.      If you originally specified the region using a double or triple
  172.      `Mouse-1', so that the region is defined to consist of entire words
  173.      or lines, then adjusting the region with `Mouse-3' also proceeds by
  174.      entire words or lines.
  175.  
  176.      If you use `Mouse-3' a second time consecutively, at the same
  177.      place, that kills the region already selected.
  178.  
  179. `Double-Mouse-1'
  180.      This key sets the region around the word which you click on.  If
  181.      you click on a character with "symbol" syntax (such as underscore,
  182.      in C mode), it sets the region around the symbol surrounding that
  183.      character.
  184.  
  185.      If you click on a character with open-parenthesis or
  186.      close-parenthesis syntax, it sets the region around the
  187.      parenthetical grouping (sexp) which that character starts or ends.
  188.      If you click on a character with string-delimiter syntax (such as
  189.      a singlequote or doublequote in C), it sets the region around the
  190.      string constant (using heuristics to figure out whether that
  191.      character is the beginning or the end of it).
  192.  
  193. `Double-Drag-Mouse-1'
  194.      This key selects a region made up of the words that you drag
  195.      across.
  196.  
  197. `Triple-Mouse-1'
  198.      This key sets the region around the line which you click on.
  199.  
  200. `Triple-Drag-Mouse-1'
  201.      This key selects a region made up of the lines that you drag
  202.      across.
  203.  
  204.    The simplest way to kill text with the mouse is to press `Mouse-1'
  205. at one end, then press `Mouse-3' twice at the other end.  *Note
  206. Killing::.  To copy the text into the kill ring without deleting it
  207. from the buffer, press `Mouse-3' just once--or just drag across the
  208. text with `Mouse-1'.  Then you can copy it elsewhere by yanking it.
  209.  
  210.    To yank the killed or copied text somewhere else, move the mouse
  211. there and press `Mouse-2'.  *Note Yanking::.  However, if
  212. `mouse-yank-at-point' is non-`nil', `Mouse-2' yanks at point.  Then it
  213. does not matter precisely where you click; all that matters is which
  214. window you click on.  The default value is `nil'.  This variable also
  215. effects yanking the secondary selection.
  216.  
  217.    To copy text to another X window, kill it or save it in the kill
  218. ring.  Under X, this also sets the "primary selection".  Then use the
  219. "paste" or "yank" command of the program operating the other window to
  220. insert the text from the selection.
  221.  
  222.    To copy text from another X window, use the "cut" or "copy" command
  223. of the program operating the other window, to select the text you want.
  224. Then yank it in Emacs with `C-y' or `Mouse-2'.
  225.  
  226.    When Emacs puts text into the kill ring, or rotates text to the front
  227. of the kill ring, it sets the "primary selection" in the X server.
  228. This is how other X clients can access the text.  Emacs also stores the
  229. text in the cut buffer, but only if the text is short enough
  230. (`x-cut-buffer-max' specifies the maximum number of characters);
  231. putting long strings in the cut buffer can be slow.
  232.  
  233.    The commands to yank the first entry in the kill ring actually check
  234. first for a primary selection in another program; after that, they check
  235. for text in the cut buffer.  If neither of those sources provides text
  236. to yank, the kill ring contents are used.
  237.  
  238. 
  239. File: emacs,  Node: Secondary Selection,  Next: Mouse References,  Prev: Mouse Commands,  Up: Frames
  240.  
  241. Secondary Selection
  242. ===================
  243.  
  244.    The "secondary selection" is another way of selecting text using X.
  245. It does not use point or the mark, so you can use it to kill text
  246. without setting point or the mark.
  247.  
  248. `M-Drag-Mouse-1'
  249.      Set the secondary selection, with one end at the place where you
  250.      press down the button, and the other end at the place where you
  251.      release it (`mouse-set-secondary').  The highlighting appears and
  252.      changes as you drag.
  253.  
  254.      If you move the mouse off the top or bottom of the window while
  255.      dragging, the window scrolls at a steady rate until you move the
  256.      mouse back into the window.  This way, you can mark regions that
  257.      don't fit entirely on the screen.
  258.  
  259. `M-Mouse-1'
  260.      Set one endpoint for the "secondary selection"
  261.      (`mouse-start-secondary').
  262.  
  263. `M-Mouse-3'
  264.      Make a secondary selection, using the place specified with
  265.      `M-Mouse-1' as the other end (`mouse-secondary-save-then-kill').
  266.      A second click at the same place kills the secondary selection
  267.      just made.
  268.  
  269. `M-Mouse-2'
  270.      Insert the secondary selection where you click
  271.      (`mouse-kill-secondary').  This places point at the end of the
  272.      yanked text.
  273.  
  274.    Double or triple clicking of `M-Mouse-1' operates on words and
  275. lines, much like `Mouse-1'.
  276.  
  277.    If `mouse-yank-at-point' is non-`nil', `M-Mouse-2' yanks at point.
  278. Then it does not matter precisely where you click; all that matters is
  279. which window you click on.  *Note Mouse Commands::.
  280.  
  281. 
  282. File: emacs,  Node: Mouse References,  Next: Menu Mouse Clicks,  Prev: Secondary Selection,  Up: Frames
  283.  
  284. Following References with the Mouse
  285. ===================================
  286.  
  287.    Some Emacs buffers display lists of various sorts.  These include
  288. lists of files, of buffers, of possible completions, of matches for a
  289. pattern, and so on.
  290.  
  291.    Since yanking text into these buffers is not very useful, most of
  292. them define `Mouse-2' specially, as a command to use or view the item
  293. you click on.
  294.  
  295.    For example, if you click `Mouse-2' on a file name in a Dired
  296. buffer, you visit the that file.  If you click `Mouse-2' on an error
  297. message in the `*Compilation*' buffer, you go to the source code for
  298. that error message.  If you click `Mouse-2' on a completion in the
  299. `*Completions*' buffer, you choose that completion.
  300.  
  301.    You can usually tell when `Mouse-2' has this special sort of meaning
  302. because the sensitive text highlights when you move the mouse over it.
  303.  
  304. 
  305. File: emacs,  Node: Menu Mouse Clicks,  Next: Mode Line Mouse,  Prev: Mouse References,  Up: Frames
  306.  
  307. Mouse Clicks for Menus
  308. ======================
  309.  
  310.    Mouse clicks modified with the CONTROL and SHIFT keys bring up menus.
  311.  
  312. `C-Mouse-1'
  313.      This menu is for selecting a buffer.
  314.  
  315. `C-Mouse-2'
  316.      This menu is for specifying faces and other text properties for
  317.      editing formatted text.  *Note Formatted Text::.
  318.  
  319. `C-Mouse-3'
  320.      This menu is mode-specific.  For most modes, this menu has the same
  321.      items as all the mode-specific menu bar menus put together.  Some
  322.      modes may specify a different menu for this button.(1)
  323.  
  324. `S-mouse-1'
  325.      This menu is for specifying the frame's default font.
  326.  
  327.    ---------- Footnotes ----------
  328.  
  329.    (1)  Some systems use `Mouse-3' for a mode-specific menu.  We took a
  330. survey of users, and found they preferred to keep `Mouse-3' for
  331. selecting and killing regions.  Hence the decision to use `C-Mouse-3'
  332. for this menu.
  333.  
  334. 
  335. File: emacs,  Node: Mode Line Mouse,  Next: Creating Frames,  Prev: Menu Mouse Clicks,  Up: Frames
  336.  
  337. Mode Line Mouse Commands
  338. ========================
  339.  
  340.    You can use mouse clicks on window mode lines to select and
  341. manipulate windows.
  342.  
  343. `Mouse-1'
  344.      `Mouse-1' on a mode line selects the window above.  By dragging
  345.      `Mouse-1' on the mode line, you can move it, thus changing the
  346.      height of the windows above and below.
  347.  
  348. `Mouse-2'
  349.      `Mouse-2' on a mode line expands that window to fill its frame.
  350.  
  351. `Mouse-3'
  352.      `Mouse-3' on a mode line deletes the window above.
  353.  
  354. `C-Mouse-2'
  355.      `C-Mouse-2' on a mode line splits the window above horizontally,
  356.      above the place in the mode line where you click.
  357.  
  358.    `C-Mouse-2' on a scroll bar splits the corresponding window
  359. vertically.  *Note Split Window::.
  360.  
  361. 
  362. File: emacs,  Node: Creating Frames,  Next: Multiple Displays,  Prev: Mode Line Mouse,  Up: Frames
  363.  
  364. Creating Frames
  365. ===============
  366.  
  367.    The prefix key `C-x 5' is analogous to `C-x 4', with parallel
  368. subcommands.  The difference is that `C-x 5' commands create a new
  369. frame rather than just a new window in the selected frame  (*Note Pop
  370. Up Window::).  If an existing visible or iconified frame already
  371. displays the requested material, these commands use the existing frame,
  372. after raising or deiconifying as necessary.
  373.  
  374.    The various `C-x 5' commands differ in how they find or create the
  375. buffer to select:
  376.  
  377. `C-x 5 2'
  378.      Create a new frame (`make-frame').
  379.  
  380. `C-x 5 b BUFNAME RET'
  381.      Select buffer BUFNAME in another window.  This runs
  382.      `switch-to-buffer-other-frame'.
  383.  
  384. `C-x 5 f FILENAME RET'
  385.      Visit file FILENAME and select its buffer in another frame.  This
  386.      runs `find-file-other-frame'.  *Note Visiting::.
  387.  
  388. `C-x 5 d DIRECTORY RET'
  389.      Select a Dired buffer for directory DIRECTORY in another frame.
  390.      This runs `dired-other-frame'.  *Note Dired::.
  391.  
  392. `C-x 5 m'
  393.      Start composing a mail message in another frame.  This runs
  394.      `mail-other-frame'.  It is the other-frame variant of `C-x m'.
  395.      *Note Sending Mail::.
  396.  
  397. `C-x 5 .'
  398.      Find a tag in the current tag table in another frame.  This runs
  399.      `find-tag-other-frame', the multiple-frame variant of `M-.'.
  400.      *Note Tags::.
  401.  
  402. `C-x 5 r FILENAME RET'
  403.      Visit file FILENAME read-only, and select its buffer in another
  404.      frame.  This runs `find-file-read-only-other-frame'.  *Note
  405.      Visiting::.
  406.  
  407.    You can control the appearance of new frames you create by setting
  408. the frame parameters in `default-frame-alist'.  You can use the
  409. variable `initial-frame-alist' to specify parameters that affect only
  410. the initial frame.  *Note Initial Parameters: (elisp)Initial
  411. Parameters, for more information.
  412.  
  413. 
  414. File: emacs,  Node: Multiple Displays,  Next: Special Buffer Frames,  Prev: Creating Frames,  Up: Frames
  415.  
  416. Multiple Displays
  417. =================
  418.  
  419.    A single Emacs can talk to more than one X Windows display.
  420. Initially, Emacs uses just one display--the one specified with the
  421. `DISPLAY' environment variable or with the `--display' option (*note
  422. Initial Options::.).  To connect to another display, use the command
  423. `make-frame-on-display':
  424.  
  425. `M-x make-frame-on-display RET DISPLAY RET'
  426.      Create a new frame on display DISPLAY.
  427.  
  428.    A single X server can handle more than one screen.  When you open
  429. frames on two screens belonging to one server, Emacs knows they share a
  430. single keyboard, and it treats all the commands arriving from these
  431. screens as a single stream of input.
  432.  
  433.    When you open frames on different X servers, Emacs makes a separate
  434. input stream for each server.  This way, two users can type
  435. simultaneously on the two displays, and Emacs will not garble their
  436. input.  Each server also has its own selected frame.  The commands you
  437. enter with a particular X server apply to that server's selected frame.
  438.  
  439.    Despite these features, people using the same Emacs job from
  440. different displays can still interfere with each other if they are not
  441. careful.  For example, if any one types `C-x C-c', that exits the Emacs
  442. job for all of them!
  443.  
  444. 
  445. File: emacs,  Node: Special Buffer Frames,  Next: Frame Parameters,  Prev: Multiple Displays,  Up: Frames
  446.  
  447. Special Buffer Frames
  448. =====================
  449.  
  450.    You can make certain chosen buffers, for which Emacs normally creates
  451. a second window when you have just one window, appear in special frames
  452. of their own.  To do this, set the variable
  453. `special-display-buffer-names' to a list of buffer names; any buffer
  454. whose name is in that list automatically gets a special frame, when an
  455. Emacs command wants to display it "in another window."
  456.  
  457.    For example, if you set the variable this way,
  458.  
  459.      (setq special-display-buffer-names
  460.            '("*Completions*" "*grep*" "*tex-shell*"))
  461.  
  462. then completion lists, `grep' output and the TeX mode shell buffer get
  463. individual frames of their own.  These frames, and the windows in them,
  464. are never automatically split or reused for any other buffers.  They
  465. continue to show the buffers they were created for, unless you alter
  466. them by hand.  Killing the special buffer deletes its frame
  467. automatically.
  468.  
  469.    More generally, you can set `special-display-regexps' to a list of
  470. regular expressions; then a buffer gets its own frame if its name
  471. matches any of those regular expressions.  (Once again, this applies
  472. only to buffers that normally get displayed for you in a separate
  473. window.)
  474.  
  475.    The variable `special-display-frame-alist' specifies the frame
  476. parameters for these frames.  It has a default value, so you don't need
  477. to set it.
  478.  
  479.    For those who know Lisp, an element of
  480. `special-display-buffer-names' or `special-display-regexps' can also be
  481. a list.  Then the first element is the buffer name or regular
  482. expression; the rest of the list specifies how to create the frame.  It
  483. can be an association list specifying frame parameter values; these
  484. values take precedence over parameter values specified in
  485. `special-display-frame-alist'.  Alternatively, it can have this form:
  486.  
  487.      (FUNCTION ARGS...)
  488.  
  489. where FUNCTION is a symbol.  Then the frame is constructed by calling
  490. FUNCTION; its first argument is the buffer, and its remaining arguments
  491. are ARGS.
  492.  
  493. 
  494. File: emacs,  Node: Frame Parameters,  Next: Scroll Bars,  Prev: Special Buffer Frames,  Up: Frames
  495.  
  496. Setting Frame Parameters
  497. ========================
  498.  
  499.    This section describes commands for altering the display style and
  500. window management behavior of the selected frame.
  501.  
  502. `M-x set-foreground-color RET COLOR RET'
  503.      Specify color COLOR for the foreground of the selected frame.
  504.  
  505. `M-x set-background-color RET COLOR RET'
  506.      Specify color COLOR for the background of the selected frame.
  507.      This changes the foreground color of the `modeline' face also, so
  508.      that it remains in inverse video compared with the default.
  509.  
  510. `M-x set-cursor-color RET COLOR RET'
  511.      Specify color COLOR for the cursor of the selected frame.
  512.  
  513. `M-x set-mouse-color RET COLOR RET'
  514.      Specify color COLOR for the mouse cursor when it is over the
  515.      selected frame.
  516.  
  517. `M-x set-border-color RET COLOR RET'
  518.      Specify color COLOR for the border of the selected frame.
  519.  
  520. `M-x list-colors-display'
  521.      Display the defined color names and show what the colors look like.
  522.      This command is somewhat slow.
  523.  
  524. `M-x auto-raise-mode'
  525.      Toggle whether or not the selected frame should auto-raise.
  526.      Auto-raise means that every time you move the mouse onto the
  527.      frame, it raises the frame.
  528.  
  529.      Note that this auto-raise feature is implemented by Emacs itself.
  530.      Some window managers also implement auto-raise.  If you enable
  531.      auto-raise for Emacs frames in your X window manager, it should
  532.      work, but it is beyond Emacs's control and therefore
  533.      `auto-raise-mode' has no effect on it.
  534.  
  535. `M-x auto-lower-mode'
  536.      Toggle whether or not the selected frame should auto-lower.
  537.      Auto-lower means that every time you move the mouse off of the
  538.      frame, the frame moves to the bottom of the stack of X windows.
  539.  
  540.      The command `auto-lower-mode' has no effect on auto-lower
  541.      implemented by the X window manager.  To control that, you must use
  542.      the appropriate window manager features.
  543.  
  544. `M-x set-default-font RET FONT RET'
  545.      Specify font FONT as the default for the selected frame.  *Note
  546.      Font X::, for ways to list the available fonts on your system.
  547.  
  548.      You can also set a frame's default font through a pop-up menu.
  549.      Press `S-Mouse-1' to activate this menu.
  550.  
  551.    In Emacs versions that use an X toolkit, the color-setting and
  552. font-setting functions don't affect menus and the menu bar, since they
  553. are displayed by their own widget classes.  To change the appearance of
  554. the menus and menu bar, you must use X resources (*note Resources X::.).
  555. *Note Colors X::, regarding colors.  *Note Font X::, regarding choice of
  556. font.
  557.  
  558.    For information on frame parameters and customization, see *Note
  559. Frame Parameters: (elisp)Frame Parameters.
  560.  
  561. 
  562. File: emacs,  Node: Scroll Bars,  Next: Menu Bars,  Prev: Frame Parameters,  Up: Frames
  563.  
  564. Scroll Bars
  565. ===========
  566.  
  567.    When using X, Emacs normally makes a "scroll bar" at the right of
  568. each Emacs window.  The scroll bar runs the height of the window, and
  569. shows a moving rectangular inner box which represents the portion of the
  570. buffer currently displayed.  The entire height of the scroll bar
  571. represents the entire length of the buffer.
  572.  
  573.    You can use `Mouse-2' (normally, the middle button) in the scroll
  574. bar to move or drag the inner box up and down.  If you move it to the
  575. top of the scroll bar, you see the top of the buffer.  If you move it to
  576. the bottom of the scroll bar, you see the bottom of the buffer.
  577.  
  578.    The left and right buttons in the scroll bar scroll by controlled
  579. increments.  `Mouse-1' (normally, the left button) moves the line at
  580. the level where you click up to the top of the window.  `Mouse-3'
  581. (normally, the right button) moves the line at the top of the window
  582. down to the level where you click.  By clicking repeatedly in the same
  583. place, you can scroll by the same distance over and over.
  584.  
  585.    Aside from scrolling, you can also click `C-Mouse-2' in the scroll
  586. bar to split a window vertically.  The split occurs on the line where
  587. you click.
  588.  
  589.    You can enable or disable Scroll Bar mode with the command `M-x
  590. scroll-bar-mode'.  With no argument, it toggles the use of scroll bars.
  591. With an argument, it turns use of scroll bars on if and only if the
  592. argument is positive.  This command applies to all frames, including
  593. frames yet to be created.  You can use the X resource
  594. `verticalScrollBars' to control the initial setting of Scroll Bar mode.
  595. *Note Resources X::.
  596.  
  597.    To enable or disable scroll bars for just the selected frame, use the
  598. `M-x toggle-scroll-bar' command.
  599.  
  600. 
  601. File: emacs,  Node: Menu Bars,  Next: Faces,  Prev: Scroll Bars,  Up: Frames
  602.  
  603. Menu Bars
  604. =========
  605.  
  606.    By default, each Emacs frame has a menu bar at the top which you can
  607. use to perform certain common operations.  There's no need to describe
  608. them in detail here, as you can more easily see for yourself; also, we
  609. may change them and add to them in subsequent Emacs versions.
  610.  
  611.    When you are using a window system, you can use the mouse to choose a
  612. command from the menu bar.  On text-only terminals, you can use the menu
  613. bar by typing `M-`' (`tmm-menubar').  This enters a mode in which you
  614. can select a menu item from the keyboard.  Either type the initial of
  615. the item you want, or use the left and right arrow keys to choose an
  616. item and use RET to finalize the choice.
  617.  
  618.    Each of the operations in the menu bar is bound to an ordinary Emacs
  619. command which you can invoke equally well with `M-x' or with its own
  620. key bindings.  The menu lists one equivalent key binding (if the command
  621. has any) at the right margin.  To see the command's name and
  622. documentation, type `C-h k' and then select the menu bar item you are
  623. interested in.
  624.  
  625.    You can turn display of menu bars on or off with `M-x
  626. menu-bar-mode'.  With no argument, this command toggles Menu Bar mode, a
  627. minor mode.  With an argument, the command turns Menu Bar mode on if the
  628. argument is positive, off if the argument is not positive.  You can use
  629. the X resource `menuBarLines' to control the initial setting of Menu
  630. Bar mode.  *Note Resources X::.  Expert users often turn off the menu
  631. bar, especially on text-only terminals where this makes one additional
  632. line available for text.
  633.  
  634. 
  635. File: emacs,  Node: Faces,  Next: Modifying Faces,  Prev: Menu Bars,  Up: Frames
  636.  
  637. Using Multiple Typefaces
  638. ========================
  639.  
  640.    When using Emacs with X, you can set up multiple styles of displaying
  641. characters.  The aspects of style that you can control are the type
  642. font, the foreground color, the background color, and whether to
  643. underline.  Emacs on MS-DOS supports faces partially by letting you
  644. control the foreground and background colors of each face (*note
  645. MS-DOS::.).
  646.  
  647.    The way you control display style is by defining named "faces".
  648. Each face can specify a type font, a foreground color, a background
  649. color, and an underline flag; but it does not have to specify all of
  650. them.
  651.  
  652.    The style of display used for a given character in the text is
  653. determined by combining several faces.  Any aspect of the display style
  654. that isn't specified by overlays or text properties comes from the frame
  655. itself.
  656.  
  657.    Enriched mode, the mode for editing formatted text, includes several
  658. commands and menus for specifying faces.  *Note Format Faces::, for how
  659. to specify the font for text in the buffer.  *Note Format Colors::, for
  660. how to specify the foreground and background color.
  661.  
  662.    To see what faces are currently defined, and what they look like,
  663. type `M-x list-faces-display'.  It's possible for a given face to look
  664. different in different frames; this command shows the appearance in the
  665. frame in which you type it.  Here's a list of the standardly defined
  666. faces:
  667.  
  668. `default'
  669.      This face is used for ordinary text that doesn't specify any other
  670.      face.
  671.  
  672. `modeline'
  673.      This face is used for mode lines.  By default, it's set up as the
  674.      inverse of the default face.  *Note Display Vars::.
  675.  
  676. `highlight'
  677.      This face is used for highlighting portions of text, in various
  678.      modes.
  679.  
  680. `region'
  681.      This face is used for displaying a selected region (when Transient
  682.      Mark mode is enabled--see below).
  683.  
  684. `secondary-selection'
  685.      This face is used for displaying a secondary selection (*note
  686.      Secondary Selection::.).
  687.  
  688. `bold'
  689.      This face uses a bold variant of the default font, if it has one.
  690.  
  691. `italic'
  692.      This face uses an italic variant of the default font, if it has
  693.      one.
  694.  
  695. `bold-italic'
  696.      This face uses a bold italic variant of the default font, if it
  697.      has one.
  698.  
  699. `underline'
  700.      This face underlines text.
  701.  
  702.    When Transient Mark mode is enabled, the text of the region is
  703. highlighted when the mark is active.  This uses the face named
  704. `region'; you can control the style of highlighting by changing the
  705. style of this face (*note Modifying Faces::.).  *Note Transient Mark::,
  706. for more information about Transient Mark mode and activation and
  707. deactivation of the mark.
  708.  
  709.    One easy way to use faces is to turn on Font Lock mode.  This minor
  710. mode, which is always local to a particular buffer, arranges to choose
  711. faces according to the syntax of the text you are editing.  It can
  712. recognize comments and strings in most languages; in several languages,
  713. it can also recognize and properly highlight various other important
  714. constructs.  *Note Font Lock::, for more information about Font Lock
  715. mode and syntactic highlighting.
  716.  
  717.    You can print out the buffer with the highlighting that appears on
  718. your screen using the command `ps-print-buffer-with-faces'.  *Note
  719. Postscript::.
  720.  
  721. 
  722. File: emacs,  Node: Modifying Faces,  Next: Font Lock,  Prev: Faces,  Up: Frames
  723.  
  724. Modifying Faces
  725. ===============
  726.  
  727.    Here are the commands for changing the font of a face:
  728.  
  729. `M-x set-face-font RET FACE RET FONT RET'
  730.      Change face FACE to use font FONT.  *Note Font X::, for more
  731.      information about font naming under X.
  732.  
  733. `M-x make-face-bold RET FACE RET'
  734.      Convert face FACE to use a bold version of its current font.
  735.  
  736. `M-x make-face-italic RET FACE RET'
  737.      Convert face FACE to use a italic version of its current font.
  738.  
  739. `M-x make-face-bold-italic RET FACE RET'
  740.      Convert face FACE to use a bold-italic version of its current font.
  741.  
  742. `M-x make-face-unbold RET FACE RET'
  743.      Convert face FACE to use a non-bold version of its current font.
  744.  
  745. `M-x make-face-unitalic RET FACE RET'
  746.      Convert face FACE to use a non-italic version of its current font.
  747.  
  748.    Here are the commands for setting the colors and underline flag of a
  749. face:
  750.  
  751. `M-x set-face-foreground RET FACE RET COLOR RET'
  752.      Use color COLOR for the foreground of characters in face FACE.
  753.  
  754. `M-x set-face-background RET FACE RET COLOR RET'
  755.      Use color COLOR for the background of characters in face FACE.
  756.  
  757.      On a black-and-white display, the colors you can use for the
  758.      background are `black', `white', `gray', `gray1' and `gray3'.
  759.      Emacs supports the gray colors by using background stipple
  760.      patterns instead of a color.
  761.  
  762. `M-x set-face-stipple RET FACE RET PATTERN RET'
  763.      Use stipple pattern PATTERN for the background of characters in
  764.      face FACE.
  765.  
  766. `M-x list-colors-display'
  767.      Display the defined color names and show what the colors look like.
  768.  
  769. `M-x set-face-underline-p RET FACE RET FLAG RET'
  770.      Specify whether to underline characters in face FACE.
  771.  
  772. `M-x invert-face RET FACE RET'
  773.      Swap the foreground and background colors of face FACE.
  774.  
  775. `M-x modify-face RET FACE RET ATTRIBUTES...'
  776.      Change various attributes of face FACE.  This command prompts for
  777.      all the attribute of the face, one attribute at a time.  For the
  778.      color and stipple attributes, the attribute's current value is the
  779.      default--type just RET if you don't want to change that attribute.
  780.      Type `none' if you want to clear out the attribute.
  781.  
  782.    You can also use X resources to specify attributes of particular
  783. faces.  *Note Resources X::.
  784.  
  785. 
  786. File: emacs,  Node: Font Lock,  Next: Support Modes,  Prev: Modifying Faces,  Up: Frames
  787.  
  788. Font Lock mode
  789. ==============
  790.  
  791.    Font Lock mode is a minor mode, always local to a particular buffer,
  792. which highlights (or "fontifies") using various faces according to the
  793. syntax of the text you are editing.  It can recognize comments and
  794. strings in most languages; in several languages, it can also recognize
  795. and properly highlight various other important constructs--for example,
  796. names of functions being defined or reserved keywords.
  797.  
  798.    The command `M-x font-lock-mode' turns Font Lock mode on or off
  799. according to the argument, and toggles the mode when it has no argument.
  800. The function `turn-on-font-lock' unconditionally enables Font Lock
  801. mode.  This is useful in mode-hook functions.  For example, to enable
  802. Font Lock mode whenever you edit a C file, you can do this:
  803.  
  804.      (add-hook 'c-mode-hook 'turn-on-font-lock)
  805.  
  806.    To turn on Font Lock mode automatically in all modes which support
  807. it, use the function `global-font-lock-mode', like this:
  808.  
  809.      (global-font-lock-mode t)
  810.  
  811.    In Font Lock mode, when you edit the text, the highlighting updates
  812. automatically in the line that you changed.  Most changes don't affect
  813. the highlighting of subsequent lines, but occasionally they do.  To
  814. rehighlight a range of lines, use the command `C-M-g'
  815. (`font-lock-fontify-block').
  816.  
  817.    In certain major modes, `C-M-g' refontifies the entire current
  818. function.  (The variable `font-lock-mark-block-function' controls how
  819. to find the current function.)  In other major modes, `C-M-g'
  820. refontifies 16 lines above and below point.
  821.  
  822.    With a prefix argument N, `C-M-g' refontifies N lines above and
  823. below point, regardless of the mode.
  824.  
  825.    To get the full benefit of Font Lock mode, you need to choose a
  826. default font which has bold, italic, and bold-italic variants; or else
  827. you need to have a color or grayscale screen.  The variable
  828. `font-lock-display-type' specifies whether Font Lock mode should use
  829. font styles, colors, or shades of gray to distinguish the various kinds
  830. of text.  Emacs chooses the default value according to the
  831. characteristics of your display.
  832.  
  833.    The variable `font-lock-maximum-decoration' specifies the preferred
  834. level of fontification for modes that provide multiple levels.  The
  835. normal default is 1; larger numbers request more fontification, and
  836. some modes support levels as high as 3.  These variables can also
  837. specify different numbers for particular major modes; for example, to
  838. use level 3 for C/C++ modes, and the default level otherwise, use this:
  839.  
  840.      (setq font-lock-maximum-decoration
  841.            '((c-mode . 3) (c++-mode . 3)))
  842.  
  843.    Fontification can be too slow for large buffers, so you can suppress
  844. it.  The variable `font-lock-maximum-size' specifies a buffer size,
  845. beyond which buffer fontification is suppressed.
  846.  
  847. 
  848. File: emacs,  Node: Support Modes,  Next: Misc X,  Prev: Font Lock,  Up: Frames
  849.  
  850. Font Lock Support Modes
  851. =======================
  852.  
  853.    Font Lock support modes make Font Lock mode faster for large buffers.
  854. There are two support modes: Fast Lock mode and Lazy Lock mode.  They
  855. use two different methods of speeding up Font Lock mode.
  856.  
  857. * Menu:
  858.  
  859. * Fast Lock Mode::     Saving font information in files.
  860. * Lazy Lock Mode::     Fontifying only text that is actually displayed.
  861. * Fast or Lazy::       Which support mode is best for you?
  862.  
  863. 
  864. File: emacs,  Node: Fast Lock Mode,  Next: Lazy Lock Mode,  Up: Support Modes
  865.  
  866. Fast Lock Mode
  867. --------------
  868.  
  869.    To make Font Lock mode faster for buffers visiting large files, you
  870. can use Fast Lock mode.  Fast Lock mode saves the font information for
  871. each file in a separate cache file; each time you visit the file, it
  872. rereads the font information from the cache file instead of refontifying
  873. the text from scratch.
  874.  
  875.    The command `M-x fast-lock-mode' turns Fast Lock mode on or off,
  876. according to the argument (with no argument, it toggles).  You can also
  877. arrange to enable Fast Lock mode whenever you use Font Lock mode, like
  878. this:
  879.  
  880.      (setq font-lock-support-mode 'fast-lock-mode)
  881.  
  882.    It is not worth writing a cache file for small buffers.  Therefore,
  883. the variable `fast-lock-minimum-size' specifies a minimum file size for
  884. caching font information.
  885.  
  886.    The variable `fast-lock-cache-directories' specifies where to put
  887. the cache files.  Its value is a list of directories to try; `"."'
  888. means the same directory as the file being edited.  The default value is
  889. `("." "~/.emacs-flc")', which means to use the same directory if
  890. possible, and otherwise the directory `~/.emacs-flc'.
  891.  
  892.    The variable `fast-lock-save-others' specifies whether Fast Lock
  893. mode should save cache files for files that you do not own.  A
  894. non-`nil' value means yes (and that is the default).
  895.  
  896. 
  897. File: emacs,  Node: Lazy Lock Mode,  Next: Fast or Lazy,  Prev: Fast Lock Mode,  Up: Support Modes
  898.  
  899. Lazy Lock Mode
  900. --------------
  901.  
  902.    To make Font Lock mode faster for large buffers, you can use Lazy
  903. Lock mode to reduce the amount of text that is fontified.  In Lazy Lock
  904. mode, buffer fontification is demand-driven; it happens to portions of
  905. the buffer that are about to be displayed.  And fontification of your
  906. changes is deferred; it happens only when Emacs has been idle for a
  907. certain short period of time.
  908.  
  909.    The command `M-x lazy-lock-mode' turns Lazy Lock mode on or off,
  910. according to the argument (with no argument, it toggles).  You can also
  911. arrange to enable Lazy Lock mode whenever you use Font Lock mode, like
  912. this:
  913.  
  914.      (setq font-lock-support-mode 'lazy-lock-mode)
  915.  
  916.    It is not worth avoiding buffer fontification for small buffers.
  917. Therefore, the variable `lazy-lock-minimum-size' specifies a minimum
  918. buffer size for demand-driven buffer fontification.  Buffers smaller
  919. than that are fontified all at once, as in plain Font Lock mode.
  920.  
  921.    When you alter the buffer, Lazy Lock mode defers fontification of the
  922. text you changed.  The variable `lazy-lock-defer-time' specifies how
  923. many seconds Emacs must be idle before it starts fontifying your
  924. changes.  If the value is `nil', then changes are fontified
  925. immediately, as in plain Font Lock mode.
  926.  
  927.    Lazy Lock mode normally fontifies newly visible portions of the
  928. buffer before they are first displayed.  However, if the value of
  929. `lazy-lock-defer-driven' is non-`nil', newly visible text is fontified
  930. only when Emacs is idle for `lazy-lock-defer-time' seconds.
  931.  
  932.    When Emacs is idle for a long time, Lazy Lock fontifies additional
  933. portions of the buffer, not yet displayed, in case you will display them
  934. later.  This is called "stealth fontification".
  935.  
  936.    The variable `lazy-lock-stealth-time' specifies how many seconds
  937. Emacs has to be idle before stealth fontification starts.  A value of
  938. `nil' means no stealth fontification.  The variables
  939. `lazy-lock-stealth-lines' and `lazy-lock-stealth-verbose' specify the
  940. granularity and verbosity of stealth fontification.
  941.  
  942. 
  943. File: emacs,  Node: Fast or Lazy,  Prev: Lazy Lock Mode,  Up: Support Modes
  944.  
  945. Fast Lock or Lazy Lock?
  946. -----------------------
  947.  
  948.    Here is a simple guide to help you choose one of the Font Lock
  949. support modes.
  950.  
  951.    * Fast Lock mode only intervenes during file visiting and buffer
  952.      killing (and related events); therefore buffer editing and window
  953.      scrolling are no faster or slower than plain Font Lock mode.
  954.  
  955.    * Fast Lock mode is slower at reading a cache file than Lazy Lock
  956.      mode is at fontifying a window; therefore Fast Lock mode is slower
  957.      at visiting a file than Lazy Lock mode.
  958.  
  959.    * Lazy Lock mode intervenes during window scrolling to fontify text
  960.      that scrolls onto the screen; therefore, scrolling is slower than
  961.      in plain Font Lock mode.
  962.  
  963.    * Lazy Lock mode doesn't fontify during buffer editing (it defers
  964.      fontification of changes); therefore, editing is faster than in
  965.      plain Font Lock mode.
  966.  
  967.    * Fast Lock mode can be fooled by a file that is kept under version
  968.      control software; therefore buffer fontification may occur even
  969.      when a cache file exists for the file.
  970.  
  971.    * Fast Lock mode only works with a buffer visiting a file; Lazy Lock
  972.      mode works with any buffer.
  973.  
  974.    * Fast Lock mode generates cache files; Lazy Lock mode does not.
  975.  
  976.    The variable `font-lock-support-mode' specifies which of these
  977. support modes to use; for example, to specify that Fast Lock mode is
  978. used for C/C++ modes, and Lazy Lock mode otherwise, set the variable
  979. like this:
  980.  
  981.      (setq font-lock-support-mode
  982.            '((c-mode . fast-lock-mode) (c++-mode . fast-lock-mode)
  983.              (t . lazy-lock-mode)))
  984.  
  985. 
  986. File: emacs,  Node: Misc X,  Next: Non-Window Terminals,  Prev: Support Modes,  Up: Frames
  987.  
  988. Miscellaneous X Window Features
  989. ===============================
  990.  
  991.    The following commands let you create, delete and operate on frames:
  992.  
  993. `C-z'
  994.      To iconify the selected Emacs frame, type `C-z'
  995.      (`iconify-or-deiconify-frame').  The normal meaning of `C-z', to
  996.      suspend Emacs, is not useful under a window system, so it has a
  997.      different binding in that case.
  998.  
  999.      If you type this command on an Emacs frame's icon, it deiconifies
  1000.      the frame.
  1001.  
  1002. `C-x 5 0'
  1003.      To delete the selected frame, type `C-x 5 0' (`delete-frame').
  1004.      This is not allowed if there is only one frame.
  1005.  
  1006. `C-x 5 o'
  1007.      Select another frame, raise it, and warp the mouse to it so that it
  1008.      stays selected.  If you repeat this command, it cycles through all
  1009.      the frames on your terminal.
  1010.  
  1011. `M-x transient-mark-mode'
  1012.      Under X Windows, when Transient Mark mode is enabled, Emacs
  1013.      highlights the region when the mark is active.  This feature is
  1014.      the main motive for using Transient Mark mode.  To toggle the
  1015.      state of this mode, use the command `M-x transient-mark-mode'.
  1016.      *Note Mark::.
  1017.  
  1018. 
  1019. File: emacs,  Node: Non-Window Terminals,  Prev: Misc X,  Up: Frames
  1020.  
  1021. Non-Window Terminals
  1022. ====================
  1023.  
  1024.    If your terminal does not have a window system that Emacs supports,
  1025. then it can display only one Emacs frame at a time.  However, you can
  1026. still create multiple Emacs frames, and switch between them.  Switching
  1027. frames on these terminals is much like switching between different
  1028. window configurations.
  1029.  
  1030.    Use `C-x 5 2' to create a new frame and switch to it; use `C-x 5 o'
  1031. to cycle through the existing frames; use `C-x 5 0' to delete the
  1032. current frame.
  1033.  
  1034.    Each frame has a number to distinguish it.  The selected frame's
  1035. number appears in the mode line after `Emacs', except when frame 1 is
  1036. selected.
  1037.  
  1038. 
  1039. File: emacs,  Node: Major Modes,  Next: Indentation,  Prev: Frames,  Up: Top
  1040.  
  1041. Major Modes
  1042. ***********
  1043.  
  1044.    Emacs provides many alternative "major modes", each of which
  1045. customizes Emacs for editing text of a particular sort.  The major modes
  1046. are mutually exclusive, and each buffer has one major mode at any time.
  1047. The mode line normally shows the name of the current major mode, in
  1048. parentheses (*note Mode Line::.).
  1049.  
  1050.    The least specialized major mode is called "Fundamental mode".  This
  1051. mode has no mode-specific redefinitions or variable settings, so that
  1052. each Emacs command behaves in its most general manner, and each option
  1053. is in its default state.  For editing text of a specific type that
  1054. Emacs knows about, such as Lisp code or English text, you should switch
  1055. to the appropriate major mode, such as Lisp mode or Text mode.
  1056.  
  1057.    Selecting a major mode changes the meanings of a few keys to become
  1058. more specifically adapted to the language being edited.  The ones which
  1059. are changed frequently are TAB, DEL, and LFD.  The prefix key `C-c'
  1060. normally contains mode-specific commands.  In addition, the commands
  1061. which handle comments use the mode to determine how comments are to be
  1062. delimited.  Many major modes redefine the syntactical properties of
  1063. characters appearing in the buffer.  *Note Syntax::.
  1064.  
  1065.    The major modes fall into three major groups.  Lisp mode (which has
  1066. several variants), C mode, Fortran mode and others are for specific
  1067. programming languages.  Text mode, Nroff mode, TeX mode and Outline
  1068. mode are for editing English text.  The remaining major modes are not
  1069. intended for use on users' files; they are used in buffers created for
  1070. specific purposes by Emacs, such as Dired mode for buffers made by Dired
  1071. (*note Dired::.), and Mail mode for buffers made by `C-x m' (*note
  1072. Sending Mail::.), and Shell mode for buffers used for communicating
  1073. with an inferior shell process (*note Interactive Shell::.).
  1074.  
  1075.    Most programming language major modes specify that only blank lines
  1076. separate paragraphs.  This is to make the paragraph commands useful.
  1077. (*Note Paragraphs::.)  They also cause Auto Fill mode to use the
  1078. definition of TAB to indent the new lines it creates.  This is because
  1079. most lines in a program are usually indented.  (*Note Indentation::.)
  1080.  
  1081. * Menu:
  1082.  
  1083. * Choosing Modes::     How major modes are specified or chosen.
  1084.  
  1085. 
  1086. File: emacs,  Node: Choosing Modes,  Prev: Major Modes,  Up: Major Modes
  1087.  
  1088. How Major Modes are Chosen
  1089. ==========================
  1090.  
  1091.    You can select a major mode explicitly for the current buffer, but
  1092. most of the time Emacs determines which mode to use based on the file
  1093. name or on special text in the file.
  1094.  
  1095.    Explicit selection of a new major mode is done with a `M-x' command.
  1096. From the name of a major mode, add `-mode' to get the name of a command
  1097. to select that mode.  Thus, you can enter Lisp mode by executing `M-x
  1098. lisp-mode'.
  1099.  
  1100.    When you visit a file, Emacs usually chooses the right major mode
  1101. based on the file's name.  For example, files whose names end in `.c'
  1102. are edited in C mode.  The correspondence between file names and major
  1103. modes is controlled by the variable `auto-mode-alist'.  Its value is a
  1104. list in which each element has this form,
  1105.  
  1106.      (REGEXP . MODE-FUNCTION)
  1107.  
  1108. or this form,
  1109.  
  1110.      (REGEXP MODE-FUNCTION FLAG)
  1111.  
  1112. For example, one element normally found in the list has the form
  1113. `("\\.c\\'" . c-mode)', and it is responsible for selecting C mode for
  1114. files whose names end in `.c'.  (Note that `\\' is needed in Lisp
  1115. syntax to include a `\' in the string, which is needed to suppress the
  1116. special meaning of `.' in regexps.)  If the element has the form
  1117. `(REGEXP MODE-FUNCTION FLAG)' and FLAG is non-nil, then after calling
  1118. FUNCTION, the suffix that matched REGEXP is deleted and the list is
  1119. searched again for another match.
  1120.  
  1121.    You can specify which major mode should be used for editing a certain
  1122. file by a special sort of text in the first nonblank line of the file.
  1123. The mode name should appear in this line both preceded and followed by
  1124. `-*-'.  Other text may appear on the line as well.  For example,
  1125.  
  1126.      ;-*-Lisp-*-
  1127.  
  1128. tells Emacs to use Lisp mode.  Such an explicit specification overrides
  1129. any defaulting based on the file name.  Note how the semicolon is used
  1130. to make Lisp treat this line as a comment.
  1131.  
  1132.    Another format of mode specification is
  1133.  
  1134.      -*-Mode: MODENAME;-*-
  1135.  
  1136. which allows you to specify local variables as well, like this:
  1137.  
  1138.      -*- mode: MODENAME; VAR: VALUE; ... -*-
  1139.  
  1140. *Note File Variables::, for more information about this.
  1141.  
  1142.    When a file's contents begin with `#!', it can serve as an
  1143. executable shell command, which works by running an interpreter named on
  1144. the file's first line.  The rest of the file is used as input to the
  1145. interpreter.
  1146.  
  1147.    When you visit such a file in Emacs, if the file's name does not
  1148. specify a major mode, Emacs uses the interpreter name on the first line
  1149. to choose a mode.  If the first line is the name of a recognized
  1150. interpreter program, such as `perl' or `tcl', Emacs uses a mode
  1151. appropriate for programs for that interpreter.  The variable
  1152. `interpreter-mode-alist' specifies the correspondence between
  1153. interpreter program names and major modes.
  1154.  
  1155.    When you visit a file that does not specify a major mode to use, or
  1156. when you create a new buffer with `C-x b', the variable
  1157. `default-major-mode' specifies which major mode to use.  Normally its
  1158. value is the symbol `fundamental-mode', which specifies Fundamental
  1159. mode.  If `default-major-mode' is `nil', the major mode is taken from
  1160. the previously selected buffer.
  1161.  
  1162.    If you change the major mode of a buffer, you can go back to the
  1163. major mode Emacs would choose automatically: use the command `M-x
  1164. normal-mode' to do this.  This is the same function that `find-file'
  1165. calls to choose the major mode.  It also processes the file's local
  1166. variables list if any.
  1167.  
  1168.